<include file="Public/header" />
    <title>首页</title>
    <link rel="stylesheet" href="__PUBLIC__/Api/assets/css/reset.css">
    <link rel="stylesheet" href="__PUBLIC__/Api/assets/css/weui.min.css">
    <link rel="stylesheet" href="__PUBLIC__/Api/assets/css/jquery-weui.css">
    <script src="__PUBLIC__/Api/assets/js/rem.js"></script>
    <link rel="stylesheet" href="__PUBLIC__/Api/assets/css/index.css">
    <link rel="stylesheet" href="__PUBLIC__/Api/assets/css/font-awesome.min.css">
    <style>
        .weui-tabbar {
            position: fixed;
            bottom: 0;
        }

        .weui-bar__item--on .weui-tabbar__icon i {
            color: #E73E72;
        }

        .weui-tabbar__lab {
            text-align: center;
            color: #999;
            font-size: 10px;
            line-height: 1.8;
        }

        .bel {
            color: #E73E72 !important;
        }
    </style>
</head>

<body>
    <div class="ho-content">
        <div class="ho-header">首页<i onclick='history.go(0)' class="fa fa-refresh seting"></i></div>
        <!-- 额度显示start -->
        <div class="ho-main">
            <div class="flex-space-around titlee">
                <span>可用额度(元)</span>
                <span>总额度(元)</span>
            </div>
            <div class="flex-space-around main-price">
                <span>¥<?php echo $shop['money']?></span>
                <span>¥<?php echo $shop['money']?></span>
            </div>
            <div class="main-status">
                <div class='demos-content-padded'>
                    <div class="weui-slider-box" id='slider2'>
                        <div class="weui-slider">
                            <div id="sliderInner" class="weui-slider__inner">
                                <div id="sliderTrack" style="width: 100%;" class="weui-slider__track"></div>
                                <div class="slide sliderstart"></div>
                                <div class="slide sliderend"></div>
                                <div id="sliderHandler" style="left: 100%;" class="weui-slider__handler"></div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="flex-space-around main-get">
                <span id="slidervalue">¥<?php echo $shop['money']?></span>
                <span>¥<?php echo $shop['money']?></span>
            </div>
        </div>
        <!-- 额度显示end -->
        <div class="ho-back-price">
            <!--<span class="red-icon"></span>-->
            <!--<span class="pri">本月借款账单应还0.00</span>-->
            <!--<span class="returnprice">立即还款</span>-->
        </div>
        <div class="ho-borrow-time">借贷天数 <b id="tbd_ts"><?php echo $shop['time']?></b>天</div>
        <!-- 文字广告轮播start -->
        <div class="ho-nav">
            <div class="huadong">
                <div class="huabox">
                    <div class="notice_active">
                        <ul>
                            <?php foreach($lb as $v){?>
                                <li class="notice_active_ch">
                                    <span><?php echo $v['phone'];?>成功借贷<?php echo $v['jdje']?></span>
                                </li>
                            <?php }?>
                        </ul>

                    </div>
                </div>
            </div>
        </div>
        <!-- 文字广告轮播end -->
        <?php if($member['start']==2 ||$member['start']==4){?>
            <div class="ho-bottom" onclick="jd()">借贷</div>
        <?php }else{?>
            <div class="ho-bottom" onclick='rz()'>马上借钱</div>
        <?php }?>
    </div>
    <!--借贷显示框-->
    <div id="qd" style="display: none">
        <div class="history-main">
            <div>
                <span>借款金额(元)</span>
                <span><b id="jdje">800.00</b>元</span>
            </div>
            <div>
                <span>固定周期</span>
                <span><b id="gdzq">7</b>天</span>
            </div>
            <div>
                <span>利息</span>
                <span><b id="lixi">239.68</b>元</span>
            </div>
            <div>
                <span>手续费</span>
                <span><b id="sxf">98</b>元</span>
            </div>
        </div>
    </div>


    <include file="Public/bottom" />

    <script src="__PUBLIC__/Api/assets/js/jquery-weui.js"></script>
    <script>
        function rz(){
            location.href="{:U('Index/certificat')}";
        }
        //借贷
        function jd(){
            var jdje=$('#slidervalue').html().substring(1);
            var ts=$('#tbd_ts').html();
            var lixi=("<?php echo $shop['lixi']?>"/100*7*jdje).toFixed(2);
            var sxf=$('#sxf').html();
            $("#jdje").html(jdje);
            $("#gdzq").html(ts);
            $("#lixi").html(lixi);



            var html=$('#qd').html();
            layer.confirm(html, {
                btn: ['确定','取消'], //按钮
                title:'借贷信息'
            }, function(){
                layer.closeAll();

                layer.prompt({title: '填写银行卡信息', formType: 3}, function(text, index){
                    var yhkphone=$("#yhkphone").val();
                    var yhkgs=$("#yhkgs").val();
                    var yhkh=text;
                    $.post("{:U('Index/jdadd')}",{jdje,ts,lixi,sxf,yhkh,yhkgs,yhkphone},function(abc){
                        if(abc.type==1){

                            //跳转到付款页面l
                            location.href="/index.php?s=/api/index/jdfk/id/"+abc.id+".html";
                        }else{
                            layer.msg(abc.msg, {icon: data.type});
                        }
                    },'json');
                });
                $('.layui-layer-content input').attr('placeholder','银行卡号');

                var html="<br/><input type='text' placeholder='预留银行手机号码' class='layui-layer-input' id='yhkphone'/><br/><input type='text' placeholder='银行卡归属' class='layui-layer-input' id='yhkgs'/>"
                $(".layui-layer-content").append(html);

            }, function(){

            });
        }

        $('#slider2').slider(function (per) {
            // 这是滑动条的位置值，0-100，不同数值可以根据比例来计算即可
            $('#slidervalue').html('¥' + parseInt(per * 0.01 * <?php echo $shop['money']?>));
//            console.log(per);
        });

        // 以下是轮播
        function timer(opj) {
            $(opj).find('ul').animate({
                marginTop: "-1rem"
            }, 500, function () {
                $(this).css({
                    marginTop: "0.2rem"
                }).find("li:first").appendTo(this);
            })
        }
        $(function () {
            var num = $('.notice_active').find('li').length;
            if (num > 1) {
                var time = setInterval('timer(".notice_active")', 3500);
                $('.gg_more a').mousemove(function () {
                    clearInterval(time);
                }).mouseout(function () {
                    time = setInterval('timer(".notice_active")', 3500);
                });
            }

            $(".news_ck").click(function () {
                location.href = $(".notice_active .notice_active_ch").children(":input").val();
            })
        });
    </script>

</body>

</html>
